/**
 * @description: 公共英文配置
 * @file: en.ts
 * @author: Evan
 * @date: 2025.06.20 14:10:36
 * @week: 周五
 * @version: V
 */

export default {
  name: 'en',
  title: 'English',

  // 公共不可修改
  message: {
    login: 'login',
    home: 'home',
    loading: 'loading',
    glpt: 'Management Platform',
    test: 'test',
    exit: 'exit',

    all: 'All',
    query: 'Query',
    data: 'Data',
    device: 'Device',
    add: 'Add',
    edit: 'Edit',
    reset: 'Reset',
    update: 'Update',
    delete: 'Delete',
    export: 'Export',
    import: 'Import',
    operate: 'Operate',
    details: 'Details',
    cancel: 'Cancel',
    confirm: 'Confirm',
    save: 'Save',
    back: 'Back',

    // 维度
    area: 'Area',
    branch: 'Branch',
    team: 'Team',
    department: 'Department',
    itemize: 'Itemize',
    system: 'System',

    time: 'Time',
    date: 'Date',
    create_time: 'Careate Time',
    start_time: 'Start Time',
    end_time: 'End Time',

    node: 'Node',
    location: 'Location',
    status: 'Status',
    success: 'Success',
    no_data: 'No Data',

    refresh: 'Refresh',
    close: 'Close',
    close_other: 'Close Other',
    close_all: 'Close All',

    view_details: 'View Details',
    print: 'Print',
    download: 'Download',

    // 图表
    max: 'Mxn',
    min: 'Min',
    avg: 'Avg',

    // 周
    weeks: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],

    yes: 'Yes',
    no: 'No'
  },

  // 模块
  // 模块
  module: {
    db: 'Dashboard',
    alarm: 'Alarm',
    base: 'Base',
    notice: 'Notice'
  },

  user: {
    home: '@:route.home',
    logout: 'logout'
  },

  // 方法
  fn: {
    // 数字转换单位
    num: ({ named }: { named: (v: string) => number }) => {
      // 转换值
      const num = named('value') || 0
      // 小数点精度
      let precision = named('precision')
      precision === void 0 && (precision = 2)

      let newNum = ''
      // 防止传入其他不可转换类型
      if (isNaN(Number(num))) return num
      if (Math.abs(num) >= 1000000000) {
        const n: any = num / 1000000000
        newNum = n.toFixed(precision) * 1 + 'B'
      } else if (Math.abs(num) >= 1000000) {
        const n: any = num / 1000000
        newNum = n.toFixed(precision) * 1 + 'M'
      } else if (Math.abs(num) >= 1000) {
        const n: any = num / 1000
        newNum = n.toFixed(precision) * 1 + 'k'
      } else {
        const n: any = num
        newNum = n.toFixed(precision) * 1 + ''
      }
      return newNum
    },

    // 转换大写数值
    bigNUm: ({ named }: { named: (v: string) => number }) => {
      // 转换值
      const num = named('value')
      return String(num)
    }
  },

  // 校验提示
  rule_tip: {
    email: 'Please enter a valid email address',
    tel: 'Please enter a valid phone number'
  },

  // 菜单
  menu: {
    disabled: 'Permission not granted yet'
  },

  // 请求状态
  request_status: {
    '400': 'Bad Request (400)',
    '401': 'Unauthorized, please log in again (401)',
    '403': 'Forbidden (403)',
    '404': 'Not Found (404)',
    '405': 'Method Not Allowed (405)',
    '406': 'Not Acceptable (406)',
    '408': 'Request Timeout (408)',
    '414': 'URI Too Long (414)',
    '500': 'Internal Server Error (500)',
    '501': 'Not Implemented (501)',
    '502': 'Bad Gateway (502)',
    '503': 'Service Unavailable (503)',
    '504': 'Gateway Timeout (504)',
    '505': 'HTTP Version Not Supported (505)',
    other: 'Connection Error'
  },

  // 组件
  component: {
    // 查询时间组件
    query_time: {
      day: 'Day',
      month: 'Month',
      year: 'Year',

      datetimerange: {
        start_time: 'start time',
        end_time: 'end time'
      },

      monthrange: {
        start_time: 'start month',
        end_time: 'end month'
      },

      yearrange: {
        start_time: 'start year',
        end_time: 'end year'
      },
      daterange: {
        start_time: 'start date',
        end_time: 'end date'
      }
    },

    // form 表单组件
    zform: {
      placeholder: {
        input: 'Enter',
        select: 'Select',
        start_date: 'Start Date',
        end_date: 'End Date'
      },
      upload: {
        btn: 'Upload',
        delete: '@:message.delete',
        tip: {
          base: 'Supported file formats include {type}，{size}Up to upload {limit} ！',
          limit: 'Up to {limit} files can be uploaded, please delete them before uploading!',
          type: 'The file format is incorrect, valid format {type}',
          size: 'The file size cannot exceed {size}'
        }
      }
    },

    // table 组件
    ztable: {
      add: '@:message.add',
      edit: '@:message.edit',

      confirm: {
        delete_title: 'Confirm',
        delete: 'Please confirm if you want to delete it?',
        delete_multiple: 'Please confirm whether to delete the selected column?'
      },

      msg: {
        success: "@:{'message.success'}！",
        delete_success: 'Delete @:ztable.msg.success',
        no_select: 'Please select the column to delete!'
      }
    },

    // 弹窗表单
    zdialogform: {
      reset: '@:message.reset',
      cancel: '@:message.cancel',
      save: '@:message.save',
      save_and_continue_add: 'Save And Add'
    }
  }
}
